<?php

use App\Http\Controllers\ExpertController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VideoController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', [VideoController::class,'shouye']);//前台首页视图
Route::prefix('/expert')->group(function (){//前台专家视图
    Route::get('/lecture',[VideoController::class,'el']);
    Route::get('/front-list',[ExpertController::class,'index']);
    Route::get('/front-list-detail/{id?}',[ExpertController::class,'show']);
});
Route::prefix('/video')->group(function (){//前台视频视图
    Route::get('/show',[VideoController::class,'index']);//前台往期视频
    Route::get('/review/{id}',[VideoController::class,'show']);//前台往期视频详情
});
//以上为前台
//以下为后台
Route::get('/login',[UserController::class,'login'])->name('login');
Route::post('/login',[UserController::class,'dologin']);
Route::get('/logout',[UserController::class,'logout']);
Route::get('/unsuccess',[UserController::class,'unsuccess']);
Route::prefix('user')->middleware('auth')->group(function (){//用户视图
    Route::get('/admin-index',[UserController::class,'index']);//总后台首页*********
    Route::get('/show-list',[UserController::class,'userlist']);//用户列表
    Route::get('/add-user',[UserController::class,'adduser']);//新增用户
    Route::post('/add-user',[UserController::class,'store']);//新增用户
    Route::get('/edit-user/{id}',[UserController::class,'edituser']);//修改用户密码
    Route::post('/edit-user/{id}',[UserController::class,'update']);//修改用户密码
    Route::get('/del-user/{id}',[UserController::class,'deluser']);//删除用户
    Route::get('/addusersuccess',[UserController::class,'addusersuccess']);
    Route::get('/editusersuccess',[UserController::class,'editusersuccess']);
});
Route::prefix('/expert')->middleware('auth')->group(function (){//后台专家视图
    Route::get('/admin-list',[ExpertController::class,'adminindex']);//后台专家展示
    Route::get('/add-list',[ExpertController::class,'create']);
    Route::post('/store-list',[ExpertController::class,'store']);
    Route::get('/edit-list/{id?}',[ExpertController::class,'edit']);
    Route::post('/update-list/{id?}',[ExpertController::class,'update']);
    Route::get('/delete-list/{id?}',[ExpertController::class,'destroy']);
});
Route::prefix('/video')->middleware('auth')->group(function (){//后台视频视图
    Route::get('/video-list',[VideoController::class,'adminlist']);
    Route::post('/add-photo',[VideoController::class,'savephoto']);
    Route::get('/list-create',[VideoController::class,'create']);
    Route::post('/list-add',[VideoController::class,'store']);
    Route::get('/list-edit/{id}',[VideoController::class,'edit']);
    Route::post('/list-update/{id}',[VideoController::class,'update']);
    Route::get('/list-delete/{id}',[VideoController::class,'destroy']);
});


